
//接口
interface Person { 
  firstName: string;
  lastName: string;
}

//定义方法
function greeter(person: string) {
  return "Hello, " + person.firstName + " " + person.lastName;
}

//注意类和接口可以一起共作
//在构造函数的参数上使用public等同于创建了同名的成员变量。
class Student {
  fullName: string;
  constructor(public firstName, public middleInitial, public lastName) {
      this.fullName = firstName + " " + middleInitial + " " + lastName;
  }
}

let user = new Student("Jane", "Ma.", "User");



document.body.innerHTML = greeter(user);